﻿Imports Microsoft.VisualBasic

Public Class clsCheckLanguage

    Public Function checkLanguageTH(ByVal value1 As String, ByVal value2 As String, ByVal value3 As String) As Boolean

        Dim result As Boolean = True
        Dim value As String = ""
        For i As Integer = 1 To 3
            If i = 1 Then
                value = value1
            ElseIf i = 2 Then
                value = value2
            Else
                value = value3
            End If

            If Not String.IsNullOrEmpty(value) Then
                For j As Integer = 0 To value.Length - 1
                    Dim c = value.Chars(j)
                    If (c >= Chr(65) And c <= Chr(122)) Then
                        result = False
                    End If
                Next
            End If
        Next

        Return result
    End Function

    Public Function checkLanguageEN(ByVal value1 As String, ByVal value2 As String, ByVal value3 As String) As Boolean
        Dim result As Boolean = True
        Dim value As String = ""
        For i As Integer = 1 To 3
            If i = 1 Then
                value = value1
            ElseIf i = 2 Then
                value = value2
            Else
                value = value3
            End If
            'If (value >= Chr(161) And value <= Chr(250)) Then
            '    result = False
            'End If

            If Not String.IsNullOrEmpty(value) Then
                For j As Integer = 0 To value.Length - 1
                    Dim c = value.Chars(j)
                    If (c >= Chr(161) And c <= Chr(250)) Then
                        result = False
                    End If
                Next
            End If
        Next

        Return result
    End Function

    Public Function checkLanguageTH(ByVal value As String) As Boolean

        Dim result As Boolean = True

        If (value >= Chr(65) And value <= Chr(122)) Then
            result = False
        End If

        Return result
    End Function

    Public Function checkLanguageEN(ByVal value As String) As Boolean
        Dim result As Boolean = True

        If (value >= Chr(161) And value <= Chr(250)) Then
            result = False
        End If

        Return result
    End Function

    Public Function checkNumber(ByVal value As String) As Boolean
        Dim result As Boolean = True

        If (value >= Chr(48) And value <= Chr(57)) Then
            result = True
        Else
            result = False
        End If

        Return result
    End Function

End Class
